<include file="__THEME__/header" />
<link href="../Public/css/tree.css" rel="stylesheet" type="text/css" />
<link href="../Public/css/purview.css" rel="stylesheet" type="text/css" />
<include file="../Public/myChannel" />
<div class="contents"> <include file="../Public/admin_tree" />
  <div class="content_pur_left R">
    <div style="width:100%;" class="L">
      <div><include file="../Public/nav_head" /></div>
      <form id="form1" method="post" action="{:U('portal/Page/doAddCategory','channelId='.$channelId)}">
        <table width="97%" border="0" cellpadding="0" cellspacing="3" align="left" class="mt10 ">
          <tr>
            <td width="90" align="right">分层名称：</td>
            <td height="30" align="left"><input class="in_put" style="width:200px" name="title" type="text" id="title" maxlength="30" />
              <input type="hidden" name="channelId" id="channelId" value="{$channelId}" />
              <input type="button" class="btn_sea" value="增加" onclick="checkForm()"/></td>
          </tr>
        </table>
      </form>
      <table width="96%" border="0" cellpadding="0" cellspacing="3"  class="mt10 ml5 diy_adm_tab">
        <tr>
          <th width="150" height="30">分层名称</th>
          <th>分层管理员（点击名字删除管理员）</th>
          <th width="130">管理操作</th>
        </tr>
        <volist name='CategoryList' id='vo'>
          <tr>
            <td>{$vo.title}</td>
            <td><php>
			$uids = explode(',', $vo['admin']);
			foreach($uids as $uid){
			</php>
			<a href="javascript:void(0)" onclick="delAdmin({$vo.id},{$uid})">{$uid|getUserName}</a>&nbsp;&nbsp;
			<php>}</php>
			</td>
            <td align="center">
			<a href="javascript:void(0)" onclick="edit({$vo.id})">编辑</a> |
			<a href="javascript:void(0)" onclick="del({$vo.id})">删除</a> |
			<a href="javascript:void(0)" onclick="admin({$vo.id})">增加管理员</a></td>
          </tr>
        </volist>
      </table>
    </div>
  </div>
</div>
<include file="__THEME__/footer" />
<script type="text/javascript">
function checkForm(){
	var title = $("#title").val();
	if(title==''){
	    alert('分层名称不能为空');
		return false;
	}
	$("#form1").submit();
}
function edit(id){
   var url = "{:U('portal/Page/editCategory',array('channelId'=>$channelId))}&id="+id;
   $.tbox.popup(url,'修改分层');
}
function del(id){
   if(confirm('确定要删除该分层吗？')){
       window.location.href = "{:U('portal/Page/deleteCategory',array('channelId'=>$channelId))}&id="+id;
   }
}
function admin(id){
   var url = "{:U('portal/Page/addAdmin',array('channelId'=>$channelId))}&id="+id;
   $.tbox.popup(url,'增加管理员');
}
function delAdmin(id,uid){
   if(confirm('确定要删除该管理员吗？')){
       window.location.href = "{:U('portal/Page/delAdmin',array('channelId'=>$channelId))}&id="+id+"&uid="+uid;
   }
}
</script>
